<template>
    <h1 v-for="(item, index) in 4" :key="index">旅游推荐</h1>
    <button @click="usecounts">增加数据</button>
    <button @click="delecounts">删除数据</button>
    <button @click="calcounts">操作数据</button>
</template>

<script>

import { useCounterStore } from '@/stores/modules/nn'
import { ref } from 'vue'

export default {
    setup() {
        const store = useCounterStore()
        // 增加数据
        const usecounts = () => { store.$state.number = ref(11) }
        // 删除数据
        const delecounts = () => { delete store.$state.number }
        // 操作数据
        const calcounts = () => { if (typeof store.$state.number !== 'undefined') { store.$state.number += 30 } }

        return {
            store,
            usecounts, delecounts, calcounts
        }
    },
}
</script>
<style scoped></style>
